<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 存入的内容必须是字符串
        var obj={
            a:1,
            b:2
        }
        // 存入对象
        sessionStorage.setItem('a123',JSON.stringify(obj))
        // 取出对象
        document.write(sessionStorage.getItem('a123'))
        // 将字符串转成对象
        var obj2=JSON.parse(sessionStorage.getItem('a123'))
        // 取出存入的对象
        document.write(obj.a)
        // 最大不超过5M
        sessionStorage.removeItem('a123')
        sessionStorage.clear()

        localStorage
    </script>
</body>
</html>